/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SRD.util;

import java.net.*;
import java.io.*;

/**
 *
 * @author ylopez
 */
public class serverThread extends Thread {
    private Socket socket = null;

    public serverThread(Socket socket){
        super("serverThread");
	this.socket = socket;
    }

    public void run() {

	try {
	    PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
	    BufferedReader in = new BufferedReader(
				    new InputStreamReader(
				    socket.getInputStream()));

            String inputLine;

	    while ((inputLine = in.readLine()) != null) {
		System.out.println(inputLine);
                out.println(inputLine);
	    }

	    out.close();
	    in.close();
	    socket.close();

	} catch (IOException e) {
	    e.printStackTrace();
	}
    }

}
